# -*- coding: utf-8 -*-
"""
2024-02-12 
main
"""
"""


from PySide6.QtWidgets import QApplication, QWidget

app = QApplication([])

# 创建一个QWidget实例
widget = QWidget()

# 设置窗口标题
widget.setWindowTitle('My First QWidget')

# 设置窗口大小
widget.setGeometry(100, 100, 300, 200)

# 显示窗口
widget.show()

# 运行应用程序的主事件循环
"""
from PySide6.QtCore import Slot, QSize
from PySide6.QtGui import QAction, QKeySequence
from PySide6.QtWidgets import QMainWindow, QApplication, QVBoxLayout, QHBoxLayout, QPushButton, QWidget, QMessageBox
from PySide6.QtCore import Qt
from PySide6.QtGui import QGuiApplication, QCloseEvent,QIcon
## from PySide6.QtCore.Qt import 

##from PySide6.QtCore import WindowState

##from top.wardyan.utils import winformutils
from top.wardyan.core.action.baseaction import WMainWindow
from top.wardyan.core.widges.tables import WTableView
from top.wardyan.core.vo.vos import Record, TableCfg, TableColCfg
from top.wardyan.projects.checktool.autokill.sticklistwindow import WWarningWindow



import os

# import rpyc

# cn = rpyc.connect("127.0.0.1", 8899)
# print("time is {}".format(cn.root.get_time()))
# print(cn.root.script_list())





class StackListWindow(WMainWindow):

    table : WTableView = None
    def __init__(self, name : str = __name__):
        WMainWindow.__init__(self, "sticklistwindow")
        ## 显示窗体具体信息
        self.main()

        self.setCentralWidget(WWarningWindow())
    

    def initMenubar(self) :
        HEIGHT = 50
        """
        hb : QHBoxLayout = QHBoxLayout()
        ## 快捷菜单: 1脚本管理 2按序生成字符串 科启奥RFID模拟器 PDA开发辅助工具 二维码工具 自定义报表管理 预警管理 款式库 数据字典
        btn : QPushButton = QPushButton("脚本管理")
        btn.setMinimumHeight(HEIGHT)
        ## btn.clicked.connect(self.button_click_script)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("按序生成字符串")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("科启奥RFID模拟器")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("PDA开发辅助工具")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("二维码工具")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("自定义报表管理")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("预警管理")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)

        btn : QPushButton = QPushButton("款式库")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        btn : QPushButton = QPushButton("数据字典")
        btn.setMinimumHeight(HEIGHT)
        hb.addWidget(btn)
        
        menuBar = QWidget()
        menuBar.setLayout(hb)
        menuBar.setMinimumHeight(HEIGHT)
        self.setMenuWidget(menuBar)
        """

    
    def main(self) :
        self.initMenubar()
        ## self.setCentralWidget()

        # layout : QVBoxLayout = QVBoxLayout()
        # layout.setAlignment(Qt.AlignmentFlag.AlignTop)
        # self.setLayout(layout)
        
        # ctrlt : QWidget = QWidget()
        # tbllayout : QHBoxLayout = QHBoxLayout()
        # ctrlt.setLayout(tbllayout)
        # layout.addWidget(ctrlt)

        # self.table = WTableView(self, __name__, "warningtable")
        # tbllayout.addWidget(self.table)

        ## self.refresh()
        
    
    # def refresh(self) :
    #     """
    #     刷新
    #     """
    #     data : list[Record] = []
    #     r : Record = Record()
    #     r.set("name", "n1")
    #     r.set("age", "2")
    #     r.set("school", "??")
    #     data.append(r)
    #     data.append(r)
    #     data.append(r)
    #     data.append(r)
    #     data.append(r)
    #     ## self.renderTable(data)
    #     self.table.render(data)


"""
class WScriptWindow (StackListWindow) :
    def __init__(self, name : str = __name__):
        StackListWindow.__init__(self, name)
        self.setWindowTitle("脚本管理")
"""

if __name__ == "__main__" :     ## or 1 == 1
    app = QApplication([])
    app.setWindowIcon(QIcon("umbrella.ico"))
    w = StackListWindow()
    ## w = WScriptWindow()
    w.show()
    app.exec()